﻿using System.Web.Security;

namespace Framework.Domain
{
    public static class EncryptionHelper
    {
        public static Md5HashType Md5HashType
        {
            get
            {
                return Md5HashType.MD5_16Bit;
            }
        }

        public static string Md5Hash(string originalString)
        {
            string hash = FormsAuthentication.HashPasswordForStoringInConfigFile(originalString, "MD5");
            switch (Md5HashType)
            {
                case Md5HashType.MD5_16Bit:
                    return hash.Substring(8, 16);
                case Md5HashType.MD5_32Bit:
                    return hash;
                default:
                    return hash;
            }
        }
    }
}
